#include "v_cpu.h"
#ifdef DEBUG
#include <stdio.h>
#endif
/* On Core i7, aaa instruction doesn't affect O, S, Z, P flag. */
void v_cpu::aaa(instruction *i) {
#ifdef DEBUG
	AL = 0x0F;
	AH = 0x00;
	printf("AL = %01X, AH = %01X.\n", AL, AH);
#endif
	if (((AL & 0xF) > 9)  || (get_AF() ==  1)) {
		AL = AL + 6;
		AH = AH + 1;
		assert_AF();
		assert_CF(); 
	}
	else {
		clear_AF();
		clear_CF();
	}
	AL = AL & 0xF;
#ifdef DEBUG
	printf("AL = %01X, AH = %01X.\n", AL, AH);
#endif
}

